home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6778 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  47 lines

  1. Path: ens-cachan.fr!news
  2. From: Gabriel Dos Reis <dosreis@DPTMaths.ENS-Cachan.Fr>
  3. Newsgroups: comp.lang.c++
  4. Subject: Help: getting trouble with array,pointer and new
  5. Date: 09 Feb 1996 22:36:00 +0100
  6. Organization: ╔cole Normale SupΘrieure de Cachan
  7. Sender: dosreis@ens-cachan.fr (Kodjo Dos Reis)
  8. Message-ID: <v8vg2ckgp1b.fsf@dptmaths.ens-cachan.fr>
  9. NNTP-Posting-Host: dptmaths.ens-cachan.fr
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=ISO-8859-1
  12. Content-Transfer-Encoding: 8bit
  13. X-Newsreader: (ding) Gnus v0.86
  14.  
  15.  
  16. Hi!
  17.  
  18. I've got some problems with C++
  19. Could someone explain me why the compiler complains about this code
  20.  
  21. typedef int myarray[10];
  22.  
  23. myarray* x;
  24.  
  25. x = new myarray; // the compiler complains here
  26.  
  27. But this code seems to work
  28.  
  29. x = new myarray[1]
  30.  
  31.  
  32.  
  33.     Gaby.
  34.  
  35. -- 
  36.               Gabriel Dos Reis
  37.    dosreis@dptmaths.ens-cachan.fr      |       dosreis@yoko.ens-cachan.fr
  38.              http://yoko.ens-cachan.fr:8080/~dosreis/
  39.  
  40.                           Combien tout ce qu'on dit est loin de ce qu'on pense.
  41.                           Que la bouche et le coeur sont peu d'intelligence. 
  42.         
  43.                                             RACINE, Britannicus Acte V,ScΦne I.
  44.  
  45.  
  46.  
  47.